import amesu from "../model/bot/amesu";
import bot from "../model/bot/amesu";
import browser, { tempDir } from "../model/browser/browser";
import func from "../model/func";
import { MsgAction, Tpl_panel_equip } from "../shared/master/MsgAction";
import { style_default } from "../style/default";

export default async function (data: MsgAction, render?: boolean) {
    let d = data.data as Tpl_panel_equip;
    func.roundNumbers(d)
    let style = new style_default();
    style.setTitle('装备信息', '⚔️')
    style.addLine(`📄名称:${d.name}`)
    style.addLine(`⚙️等级:Lv.${d.leve.num}(${func.BN(d.leve.now)}/${func.BN(d.leve.max)})`)
    style.addLine(`⭐️评分:${d.score ? d.score : '未知'}`)
    style.addLine(`🔎来源:${d.from}`)
    style.setline_Title('装备属性', '📄')
    d.att.Hp_Max && style.addLine(`❤生命值+${d.att.Hp_Max}`)
    d.att.Hp_res && style.addLine(`💖生命恢复+${d.att.Hp_res}`)
    d.att.Mp_Max && style.addLine(`💧魔法值+${d.att.Mp_Max}`)
    d.att.Mp_res && style.addLine(`⏳魔法恢复+${d.att.Mp_res}`)

    d.att.Physical_Ls && style.addLine(`🩸物理吸血+${d.att.Physical_Ls}`)
    d.att.Physical_crit && style.addLine(`💥物理暴击率+${d.att.Physical_crit}`)
    d.att.Attack_Speed && style.addLine(`⚡️攻击速度+${d.att.Attack_Speed}`)

    d.att.Magic_Ls && style.addLine(`✝️法术吸血+${d.att.Magic_Ls}`)
    d.att.Magic_crit && style.addLine(`☪️法术暴击率+${d.att.Magic_crit}`)
    d.att.Calls_cont && style.addLine(`⚛️召唤数量+${d.att.Calls_cont}`)
    d.att.Calls_sore && style.addLine(`⭐️召唤评分+${d.att.Calls_sore}`)

    if (d.att.Calls_leveMin || d.att.Calls_leveMax) {
        style.addLine(`🔯召唤等级【${d.att.Calls_leveMin}-${d.att.Calls_leveMax}】`)
    }
    d.att.Physical_defense && style.addLine(`🛡️物理防御+${d.att.Physical_defense}`)
    d.att.Magic_defense && style.addLine(`☯️魔法防御+${d.att.Magic_defense}`)
    if (d.att.Magic_Attack_min || d.att.Magic_Attack_max) {
        style.addLine(`🔮魔法攻击【${d.att.Magic_Attack_min}-${d.att.Magic_Attack_max}】`)
    }
    if (d.att.Physical_Attack_min || d.att.Physical_Attack_max) {
        style.addLine(`🗡️物理攻击【${d.att.Physical_Attack_min}-${d.att.Physical_Attack_max}】`)
    }
    if(!render){
        amesu.sendText(data.tolocation, style.end());
    }else{
        return await style.img()
    }
    // if (!render) {
    //     style.toimg(data.tolocation)
    // } else {
    //     return await style.img()
    // }


}